<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class WxShopGoods extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'wx_shop_goods';

    public function classify(){
        return $this->hasOne(WxShopClassify::class,'id','classify_id');
    }


    public function product(){
        return $this->hasMany(WxShopGoodsProduct::class,'goods_id','id');
    }


    public function getPicAttribute($pictures)
    {
        return explode(',',$pictures);
    }


    public function getTagAttribute($a){
        $arr = json_decode($a,false);
        return $arr;
    }
}
